import React from 'react';
import BreadcrumbCustom from '../../BreadcrumbCustom';
import {Row, Tabs} from 'antd';
import * as Request from '../../../Server/Upgrade';
import * as config from '../../../axios/config';
import LimitVersionTable from "./LimitVersionTable";
require('./commonInfo.css');
const TabPane = Tabs.TabPane;

class LimitVersion extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            activeKey : '1'
        };
    }

    changeTab = (activeKey) => {
        this.setState({activeKey});
    }

    render(){
        return (
            <div>
                <Row>
                    <BreadcrumbCustom first={'限制版本表'}/>
                </Row>
                <Row style={{paddingTop:5}}>
                    <Tabs activeKey={this.state.activeKey} type={'card'} onChange={this.changeTab}>
                        <TabPane tab={'允许版本表'} key={'1'}>
                            <LimitVersionTable
                                page={Request.allowVersionsPage}
                                saveOrEdit={Request.allowVersionSaveOrEdit}
                                find = {Request.allowVersionGetById}
                                delete = {Request.allowVersionDeleteById}
                                validator = {Request.allowVersionValidator}
                                importUrl = {config.ALLOW_VERSON_IMPORT}
                                export = {Request.allowVersionExport}
                                title = {'允许版本'}
                            />
                        </TabPane>
                        <TabPane tab={'拒绝版本表'} key={'2'}>
                            <LimitVersionTable
                                page={Request.denyVersionsPage}
                                saveOrEdit={Request.denyVersionSaveOrEdit}
                                find = {Request.denyVersionGetById}
                                delete = {Request.denyVersionDeleteById}
                                validator = {Request.denyVersionValidator}
                                importUrl = {config.DENY_VERSION_IMPORT}
                                export = {Request.denyVersionExport}
                                title = {'拒绝版本'}
                            />
                        </TabPane>
                    </Tabs>
                </Row>
            </div>
        );
    }
}

export default LimitVersion;